<script lang="ts" setup>

const model = defineModel<string>();

onMounted(() => {
  window.electron.ipcRenderer.on('application:select-file-path-result', (_event, path) => {
    model.value = path
  })
})

onUnmounted(() => {
  window.electron.ipcRenderer.removeAllListeners('application:select-file-path-result')
})

function handleSelectFilePath() {
  window.electron.ipcRenderer.send('application:select-file-path')
}
</script>

<template>
  <div class="select-file-path">
    <el-input disabled v-model="model" />
    <el-button type="primary" @click="handleSelectFilePath" >
      <el-icon>
        <IconMdiMoreHoriz />
      </el-icon>
    </el-button>
  </div>
</template>


<style lang="less" scoped>
.select-file-path {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}
</style>
